package ade.prime.model;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * @author Kay
 *
 */
public class Resource implements Parcelable {
	
	protected String resource ;

	public static final Parcelable.Creator<Resource> CREATOR = new Creator<Resource>() {

		@Override
		public Resource[] newArray(int size) {
			return new Resource[size] ;
		}// newArray(int)

		@Override
		public Resource createFromParcel(Parcel source) {
			if (source.readInt() == 0) {
				return new Resource(source) ;
			}
			return StudentNumber.CREATOR.createFromParcel(source) ;
		}// createFromParcel(Parcel)

	} ;

	/**
	 * @param resource
	 */
	public Resource(String resource) {
		super();
		this.resource = resource;
	}
	
	/**
	 * 
	 */
	public Resource(Parcel in) {
		this(in.readString()) ;
	}
	
	/**
	 * @return the resource
	 */
	public String getResource() {
		return this.resource;
	}
	
	/**
	 * @param resource the resource to set
	 */
	public void setResource(String resource) {
		this.resource = resource;
	}

	/* (non-Javadoc)
	 * @see android.os.Parcelable#describeContents()
	 */
	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	/* (non-Javadoc)
	 * @see android.os.Parcelable#writeToParcel(android.os.Parcel, int)
	 */
	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeInt(0) ;
		dest.writeString(this.resource) ;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return String.format("%s", this.resource) ; //$NON-NLS-1$
	}
	
}
